{% extends 'index.html' %}

{% block title %} {{ page_title }} {% endblock %}

{% block styles %}
    <link rel="stylesheet" type="text/css" href="/static/monitor.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/south-street/jquery-ui-1.8.11.custom.css" />
    <link rel="stylesheet" type="text/css" href="/static/js/facebox/src/facebox.css" />
{% endblock %}

{% block scripts %}
    <script type="text/javascript" language="javascript" src="/static/js/jquery-ui-1.8.11.custom.min.js"></script>
    <script type="text/javascript" language="javascript" src="/static/js/facebox/src/facebox.js"></script>
    <script type="text/javascript" language="javascript" src="/static/js/link-addins.js"></script>
{% endblock %}

{% block sidebar %}
{% endblock %}

{% block messages %}
    <div class="message-content">
        {% for message in messages %}
        <div class="{{ message.type }}">
            <img src="/static/images/spacer.gif" class="ui-icon-active ui-icon-{{ message.type }}" />
            <span>
            {{ message.body }}
            {% if message.url %}
                <a href="{{ message.url}}">{{ message.url_text }}</a>
            {% endif %}
            </span>
        </div>
        {% endfor %}
    </div>
{% endblock %}

{% block content %}
    <div class="sidepane-right r6">
        <h3 class="shadow2"><a href="#">Add provider</a></h3>
        <div class="pane" >
        <form action="{{ action }}" method="{{ method }}" name="{{ name }}" class="form left" id="{{ name }}">
            {% csrf_token %}
            <fieldset class="new-link r6">
            <legend class="r6">Create provider</legend>
                <div>{{ form.name }}{{ form.ip_range }}</div>
                <div class="form-buttons">
                    <span>
                        <input class="form-button" type="submit" name="save" value="Save" />
                    </span>
                </div>
            </fieldset>
        </form>
        </div>
    </div>
    <div class="container">
    <table class="r6">
        <tr class="headline">
            <td class="link-title">Provider</td>
            <td class="link-link">
                <span>IP</span>
            </td>
            <td class="link-actions">Action</td>
        </tr>
        {% if providers|length > 0 %}
        {% for provider in providers %}
        <tr class="{% cycle 'odd' 'even' %} row">
            <td class="link-title" rel="{{ provider.name }}">
                <span><strong>{{ provider.name }}</strong></span>
            </td>
            <td class="link-link" rel="{{ provider.ip_range }}">
                <span><strong>{{ provider.ip_range }}</strong></span>
            </td>
            <td class="link-actions">
                <a href="/view/provider/{{ provider.id }}">
                    <img src="/static/images/spacer.gif" rel="{{ provider.name }}" class="link-tools ui-icon ui-icon-pencil" width="24" height="24" title="Edit">
                </a>
                <a href="/remove/provider/{{ provider.id }}">
                    <img src="/static/images/spacer.gif" rel="{{ provider.name }}" class="link-tools ui-icon ui-icon-trash" width="24" height="24" title="Remove">
                </a>
            </td>
        </tr>
        {% endfor %}
        {% else %}
            <tr class="{% cycle 'odd' 'even' %} row">
                <td colspan="3" class="align-center pad5">
                    <span>There're no providers in the system</span>
                </td>
            </tr>
        {% endif %}
    </table>
    </div>
{% endblock %}
